/*
 *  Copyright (C) 2011 Hatsites
 *
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU General Public License
 *  as published by the Free Software Foundation; either version 2
 *  of the License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

package org.myorg.ctm.etk.gui.swg.display.create.user.panel;

import org.myorg.ctm.etk.dtb.structure.dtb.tbl.TblUsr;
import org.myorg.ctm.etk.gui.swg.display.create.PnlAdressePostale;
import org.myorg.ctm.etk.gui.swg.display.create.PnlIdtHmn;
import org.myorg.ctm.etk.gui.swg.display.create.item.panel.PnlEmail;
import org.myorg.ctm.etk.gui.swg.display.create.panel.PnlNewAbs;

/**
 *
 * @author Hatsites
 *
 * email: Hatsites_AT_gmail.com
 * ... please remove "_AT_" from the above string to get the right email address
 */

public class PnlNewUsrAbs extends PnlNewAbs{
    protected PnlNewUsrAbs(String strGrp){
        this._pnlId_ = new PnlIdtHmn();
        this._pnlAdr_ = new PnlAdressePostale();
        this._pnlLgn_ = new PnlLoginPassword();
        this._pnlEml_ = new PnlEmail();

        this._strGrp_ = strGrp;

    }
    
    public boolean init() {
        if(!this._pnlEml_.init()){
            return false;
        }
        if (!this._pnlId_.init()){
            return false;
        }
        if(!this._pnlLgn_.init()){
            return false;
        }
        if(!this._pnlAdr_.init()){
            return false;
        }


        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(_pnlId_)
                .addComponent(_pnlAdr_)
                .addComponent(_pnlEml_)
                .addComponent(_pnlLgn_)
            )
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createParallelGroup()
                .addComponent(this._pnlId_)
                .addComponent(this._pnlAdr_)
                .addComponent(this._pnlLgn_)
                .addComponent(this._pnlEml_)
            )
        );
        return true;
    }

    public void destroy() {
        return;
    }
    public String getIdentiteNom(){
        return this._pnlId_.getIdentiteNom();
    }
    public String getIdentitePrenom1(){
        return this._pnlId_.getIdentitePrenom1();
    }
    public String getIdentitePrenom2(){
        return this._pnlId_.getIdentitePrenom2();
    }
    public String getIdentitePrenom3(){
        return this._pnlId_.getIdentitePrenom3();
    }
    public String getIdentiteDateNaissance(){
        return this._pnlId_.getIdentiteDateNaissance();
    }
    public String getIdentiteSexe(){
        return this._pnlId_.getIdentiteSexe();
    }
    public String getAdresseNumero(){
        return this._pnlAdr_.getAdresseNumero();
    }
    public String getAdresseVoie(){
        return this._pnlAdr_.getAdresseVoie();
    }
    public String getAdresseLigne1(){
        return this._pnlAdr_.getAdresseLigne1();
    }
    public String getAdresseLigne2(){
        return this._pnlAdr_.getAdresseLigne2();
    }
    public String getAdresseCode(){
        return this._pnlAdr_.getAdresseCode();
    }
    public String getAdresseVille(){
        return this._pnlAdr_.getAdresseVille();
    }
    public String getAdressePays(){
        return this._pnlAdr_.getAdressePays();
    }
    public String getLogin(){
        return this._pnlLgn_.getLogin();
    }
    public String getPassword(){
        return this._pnlLgn_.getPassword();
    }
    public String getConfirmPassword(){
        return this._pnlLgn_.getConfirmPassword();
    }
    public String getTravailMail(){
        return this._pnlEml_.getTravailMail();
    }
    public String getTravailFixe(){
        return this._pnlEml_.getTravailFixe();
    }
    public String getTravailPortable(){
        return this._pnlEml_.getTravailPortable();
    }
    public String getPersonnelMail(){
        return this._pnlEml_.getPersonnelMail();
    }
    public String getPersonnelFixe(){
        return this._pnlEml_.getPersonnelFixe();
    }
    public String getPersonnelPortable(){
        return this._pnlEml_.getPersonnePortable();
    }

    private PnlIdtHmn _pnlId_;
    private PnlAdressePostale _pnlAdr_;
    private PnlLoginPassword _pnlLgn_;
    private PnlEmail _pnlEml_;
    private String _strGrp_;

    public void writeUserInputs() {
        TblUsr.s_getInstance().setValue(TblUsr.STR_IDT_GROUPE, this._strGrp_);
        TblUsr.s_getInstance().setValue(TblUsr.STR_IDT_NOM,  this._pnlId_.getIdentiteNom());
        TblUsr.s_getInstance().setValue(TblUsr.STR_IDT_PRENOM1, this._pnlId_.getIdentitePrenom1());
        TblUsr.s_getInstance().setValue(TblUsr.STR_IDT_PRENOM2, this._pnlId_.getIdentitePrenom2());
        TblUsr.s_getInstance().setValue(TblUsr.STR_IDT_PRENOM3, this._pnlId_.getIdentitePrenom3());
        TblUsr.s_getInstance().setValue(TblUsr.STR_IDT_BIRTH, this._pnlId_.getIdentiteDateNaissance());
        TblUsr.s_getInstance().setValue(TblUsr.STR_IDT_SEXE, this._pnlId_.getIdentiteSexe());
        TblUsr.s_getInstance().setValue(TblUsr.STR_ADR_NUMERO, this._pnlAdr_.getAdresseNumero());
        TblUsr.s_getInstance().setValue(TblUsr.STR_ADR_VOIE, this._pnlAdr_.getAdresseVoie());
        TblUsr.s_getInstance().setValue(TblUsr.STR_ADR_LIGNE1, this._pnlAdr_.getAdresseLigne1());
        TblUsr.s_getInstance().setValue(TblUsr.STR_ADR_LIGNE2, this._pnlAdr_.getAdresseLigne2());
        TblUsr.s_getInstance().setValue(TblUsr.STR_ADR_CODE, this._pnlAdr_.getAdresseCode());
        TblUsr.s_getInstance().setValue(TblUsr.STR_ADR_VILLE, this._pnlAdr_.getAdresseVille());
        TblUsr.s_getInstance().setValue(TblUsr.STR_ADR_PAYS, this._pnlAdr_.getAdressePays());
        TblUsr.s_getInstance().setValue(TblUsr.STR_LOGIN, this._pnlLgn_.getLogin());
        TblUsr.s_getInstance().setValue(TblUsr.STR_PASSWORD, this._pnlLgn_.getPassword());
        TblUsr.s_getInstance().setValue(TblUsr.STR_TRAVAIL_MAIL, this._pnlEml_.getTravailMail());
        TblUsr.s_getInstance().setValue(TblUsr.STR_TRAVAIL_FIXE, this._pnlEml_.getTravailFixe());
        TblUsr.s_getInstance().setValue(TblUsr.STR_TRAVAIL_PORTABLE, this._pnlEml_.getTravailPortable());
        TblUsr.s_getInstance().setValue(TblUsr.STR_PERSO_MAIL, this._pnlEml_.getPersonnelMail());
        TblUsr.s_getInstance().setValue(TblUsr.STR_PERSO_FIXE, this._pnlEml_.getPersonnelFixe());
        TblUsr.s_getInstance().setValue(TblUsr.STR_PERSO_PORTABLE, this._pnlEml_.getPersonnePortable());


        return;
    }
}
